
import java.util.Scanner;

public class Code {
    public static void solve(int n) {
        int minItems = Integer.MAX_VALUE;
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n/3; j++) {
                for (int k = 0; k <= n/6; k++) {
                    for (int t = 0; t <= n/10; t++) {
                        if (i + 3*j + 6*k + 10*t <= n) {
                            int totalItems = i + j + k + t + (n - i - 3*j - 6*k - 10*t) / 15;
                            minItems = Math.min(minItems, totalItems);
                        }
                    }
                }
            }
        }
        System.out.println(minItems);
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int test = scanner.nextInt();
        while (test-- > 0) {
            int n = scanner.nextInt();
            solve(n);
        }
        scanner.close();
    }
}
